<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use DB;
use DateTimeInterface;

class Miniappswxaauth extends Model
{
    protected $table = 'miniapps_wxaauth';
    protected $primaryKey = 'id';

    public static function getMiniappsAuth($appid)
    {
        return self::where("appid",$appid)->first();
    }

    public static function insertAuth($appid,$authInfo,$taskid,$apply_status,$status)
    {
        return self::insertGetId([
            'appid' => $appid,
            'auth_info' => $authInfo,
            'taskid' => $taskid,
            'apply_status' => $apply_status,
            'status' => $status,
            'created_at' => time(),
        ]);
    }
}
